package com.hjb.result;

public class Result {

    private final static String SUCCESS = "success";

    public static <T> RetModel<T> buildOk() {
        return new RetModel<T>().setCode(RetCode.SUCCESS).setMsg(SUCCESS);
    }

    public static <T> RetModel<T> buildOk(T data) {
        return new RetModel<T>().setCode(RetCode.SUCCESS).setMsg(SUCCESS).setData(data);
    }

    public static <T> RetModel<T> buildErr(String message) {
        return new RetModel<T>().setCode(RetCode.FAIL).setMsg(SUCCESS);
    }

    public static <T> RetModel<T> build(int code, String msg) {
        return new RetModel<T>().setCode(code).setMsg(msg);
    }

    public static <T> RetModel<T> build(int code, String msg, T data) {
        return new RetModel<T>().setCode(code).setMsg(msg).setData(data);
    }
}